import request from '@/utils/request'

const PLAN_CASE_BASE_URL = 'planCase/'

export function getPlanCaseList(params) {
  return request({
    url: PLAN_CASE_BASE_URL,
    method: 'get',
    params: params
  })
}

export function getPlanCase(id) {
  return request({
    url: PLAN_CASE_BASE_URL + id + '/',
    method: 'get'
  })
}

export function createPlanCase(data) {
  return request({
    url: PLAN_CASE_BASE_URL,
    method: 'post',
    data: data
  })
}

export function updatePlanCase(id, data) {
  return request({
    url: PLAN_CASE_BASE_URL + id + '/',
    method: 'patch',
    data: data
  })
}

export function deletePlanCase(id) {
  return request({
    url: PLAN_CASE_BASE_URL + id + '/',
    method: 'delete'
  })
}

export function createPlanCases(planId, caseIds) {
  return request({
    url: PLAN_CASE_BASE_URL + planId + '/add_cases_to_plan/',
    method: 'post',
    data: {
      'caseIds': caseIds
    }
  })
}
